# Contributor: Nick Black <dankamongmen@gmail.com>
# Maintainer: Nick Black <dankamongmen@gmail.com>
pkgname=notcurses
pkgver=1.6.3
pkgrel=0
pkgdesc="Blingful character graphics and TUI library"
url="https://nick-black.com/dankwiki/index.php/Notcurses"
arch="all"
license="Apache-2.0"
depends="ncurses-terminfo"
makedepends="cmake ncurses-dev linux-headers ffmpeg-dev"
subpackages="$pkgname-static $pkgname-dbg $pkgname-dev $pkgname-doc"
source="$pkgname-$pkgver.tar.gz::https://github.com/dankamongmen/notcurses/archive/v$pkgver.tar.gz"

# FIXME we've got a testsuite, but it requires doctest, which is not yet in
# Alpine. once doctest is available, run "make test" from within "build".
options="!check"

build() {
	if [ "$CBUILD" != "$CHOST" ]; then
		CMAKE_CROSSOPTS="-DCMAKE_SYSTEM_NAME=Linux -DCMAKE_HOST_SYSTEM_NAME=Linux"
	fi
	cmake -B build \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib \
		-DBUILD_SHARED_LIBS=True \
		-DBUILD_TESTING=off \
		-DCMAKE_BUILD_TYPE=None \
		-DUSE_PANDOC=off \
		-DUSE_QRCODEGEN=off \
		-DUSE_PYTHON=off \
		$CMAKE_CROSSOPTS
	make -C build
}

package() {
	make -C build DESTDIR="$pkgdir" install
}

sha512sums="9d3779000619230fc0e3f1e9ae0dc306e7e26bcd45329d453074017605dcc1fe1659e87e975820b326aed0d56076842aea3e3b59e05faf55e84f2eb2651ed1f9  notcurses-1.6.3.tar.gz"
